/****************************************************************************
 * Copyright (c) 2021 Qualcomm Technologies International, Ltd.
****************************************************************************/
/**
 *
 * \file  wnd200_struct_public.h
 * \ingroup lib_private\aanc
 *
 * WND200 library header file providing public data structures.
 *
 */
#ifndef _WND200_LIB_STRUCT_PUBLIC_H_
#define _WND200_LIB_STRUCT_PUBLIC_H_

/* Imports Kalimba type definitions */
#include "types.h"

/* Include WND2100 definitions */
#include "wnd200_defs_public.h"

/******************************************************************************
Public Constant Definitions
*/

/******************************************************************************
Public Variable Definitions.

There provide a means to pass data and variables into and out of the WND200
library.
*/

/* Type definition for the WND200_1mic library. Note that this must be allocated
 * with enough space as determined by `aanc_wnd200_1mic_dmx_bytes` to ensure the
 * private fields are allocated.
 */
typedef struct _WND200_1MIC_DMX
{
    int wnd_threshold;      /* Threshold above which detection flag is set */
    int wind_detect_level;  /* Wind detection level */
    int filter_decay_time;  /* Wind filter decay time */
    int filter_attack_time; /* Wind filter attack time */
    int wnd_block_size;     /* Number of samples to use in wind detector */
    bool licensed;          /* Flag to indicate license status */

    /* Private fields follow */
} WND200_1MIC_DMX;

/* Type definition for the WND200_2mic library. Note that this must be allocated
 * with enough space as determined by `aanc_wnd200_1mic_dmx_bytes` to ensure the
 * private fields are allocated.
 */
typedef struct _WND200_2MIC_DMX
{
    /* Pointers to I/O buffers for the WND200 library that must be set
     * prior to initialization.
     */
    tCbuffer *p_aux_ip;     /* Auxiliary microphone input buffer pointer */

    /* Parameters for the WND200 library */
    int wnd_threshold;      /* Threshold above which detection flag is set */
    int wind_detect_level;  /* Wind detection level */
    int filter_decay_time;  /* Wind filter decay time */
    int filter_attack_time; /* Wind filter attack time */
    int wnd_block_size;     /* Number of samples to use in wind detector */
    bool licensed;          /* Flag to indicate license status */

    /* Private fields follow */
} WND200_2MIC_DMX;

/* Type definition for the WND200_common library. Note that this must be allocated
 * with enough space as determined by `aanc_wnd200_common_dmx_bytes` to ensure the
 * private fields are allocated.
 */
typedef struct _WND200_COMMON_DMX
{
    tCbuffer *p_main_ip;    /* Main microphone input buffer pointer */
    tCbuffer *p_tmp;        /* Temporary buffer pointer */
    /* Threshold that decides if there is enough INSTANTANEOUS power for the
     * signal to be wind
     */
    int pwr_threshold;
    /* Thresholds for relating the power level to wind intensity during a
     * detection. Above the high threshold is "high", between high and low is
     * "medium" and below low is "low".
     */
    uint32 high_wind_thr;
    uint32 med_wind_thr;
    uint32 high_rel_wind_thr;
    uint32 med_rel_wind_thr;
    int envelope_time;      /* Time constant for power estimate envelope */
    int attack_time;        /* Time constant for min power estimate */
    int main_mic_pwr;       /* Power level from the main microphone */
    int prev_intensity;  
                            /* Previous frame intensity */
    int main_mic_min_pwr;   /* Minimum power level from the main microphone */
    unsigned sample_rate;   /* Audio sample rate */

    int frame_size;         /* Number of samples in frame */
    bool intensity_ctrl;    /* True to enable 3 intensity categorization functionality
                               False for existing functionality */
    /* Statistics from the WND200 library */
    int wind_flag;          /* Wind detection flag */
    int wind_state;         /* Wind intensity */
} WND200_COMMON_DMX;
#endif /* _WND200_LIB_STRUCT_PUBLIC_H_ */
